from datetime import date
from utils.random_time_tool import generate_random_times


def normal_day_data_generate(work_time):  # params 班别
    CHECK_IN_TIME = {
        "NORMAL_DAY_WORK_TIME": {  # 常日班   双休
            "NORMAL_WORK_TIME": {
                "ENTER_OFFICE": {
                    "start": "07:45",
                    "end": "08:01",
                },
                "OUT_OFFICE": {
                    "start": "17:00",
                    "end": "17:16",
                }
            },  # 正常上班时间
            "DAY_OFF": "None",  # 休息日
        }
    }

    if work_time == "休息日":
        enter_office = out_office = CHECK_IN_TIME["NORMAL_DAY_WORK_TIME"]["DAY_OFF"]

        return enter_office, out_office

    else:
        enter_office = generate_random_times(CHECK_IN_TIME["NORMAL_DAY_WORK_TIME"]["NORMAL_WORK_TIME"]["ENTER_OFFICE"]["start"],
                                            CHECK_IN_TIME["NORMAL_DAY_WORK_TIME"]["NORMAL_WORK_TIME"]["ENTER_OFFICE"]["end"], 1)

        out_office = generate_random_times(CHECK_IN_TIME["NORMAL_DAY_WORK_TIME"]["NORMAL_WORK_TIME"]["OUT_OFFICE"]["start"],
                                           CHECK_IN_TIME["NORMAL_DAY_WORK_TIME"]["NORMAL_WORK_TIME"]["OUT_OFFICE"]["end"], 1)

        return enter_office, out_office


def other_day_data_generate(work_time):
    CHECK_IN_TIME = {
        "OTHER_DAY_WORK": {  # 其他   周六日选一天休息
            "MORNING_WORK_TIME": {
                "ENTER_OFFICE": {
                    "start": "07:45",
                    "end": "08:01",
                },
                "OUT_OFFICE": {
                    "start": "20:00",
                    "end": "20:16",
                }
            },  # 早班
            "NIGHT_WORK_TIME": {
                "ENTER_OFFICE": {
                    "start": "19:45",
                    "end": "20:01",
                },
                "OUT_OFFICE": {
                    "start": "08:00",
                    "end": "08:16"
                }
            },  # 夜班
            "DAY_OFF": "None",  # 休息日
        }
    }

    if work_time == "休息日" or work_time == "常日班":
        enter_office = out_office = CHECK_IN_TIME["OTHER_DAY_WORK"]["DAY_OFF"]

        return enter_office, out_office

    elif work_time == "白班":
        enter_office = generate_random_times(
            CHECK_IN_TIME["OTHER_DAY_WORK"]["MORNING_WORK_TIME"]["ENTER_OFFICE"]["start"],
            CHECK_IN_TIME["OTHER_DAY_WORK"]["MORNING_WORK_TIME"]["ENTER_OFFICE"]["end"], 1)

        out_office = generate_random_times(
            CHECK_IN_TIME["OTHER_DAY_WORK"]["MORNING_WORK_TIME"]["OUT_OFFICE"]["start"],
            CHECK_IN_TIME["OTHER_DAY_WORK"]["MORNING_WORK_TIME"]["OUT_OFFICE"]["end"], 1)

        return enter_office, out_office


    elif work_time == "夜班":
        enter_office = generate_random_times(
            CHECK_IN_TIME["OTHER_DAY_WORK"]["NIGHT_WORK_TIME"]["ENTER_OFFICE"]["start"],
            CHECK_IN_TIME["OTHER_DAY_WORK"]["NIGHT_WORK_TIME"]["ENTER_OFFICE"]["end"], 1)

        out_office = generate_random_times(
            CHECK_IN_TIME["OTHER_DAY_WORK"]["NIGHT_WORK_TIME"]["OUT_OFFICE"]["start"],
            CHECK_IN_TIME["OTHER_DAY_WORK"]["NIGHT_WORK_TIME"]["OUT_OFFICE"]["end"], 1)

        return enter_office, out_office



